package com.newtouch.avmarketing.mgr.modules.avmarkrting.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageResult<V> {
    private int code = ResultCodes.SUCCESS_CODE;
    private String message = "ok";

    private long totals;
    private int totalPages;
    private List<V> items;

    public static <V> PageResult<V> empty() {
        return new PageResult<V>();
    }

    public static <V> PageResult<V> of(long totals, int totalPages, List<V> items) {
        PageResult<V> pageResult = new PageResult<>();
        pageResult.setTotals(totals);
        pageResult.setTotalPages(totalPages);
        pageResult.setItems(items);

        return pageResult;
    }
}